﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace WindowsFormsApp1
{
    public partial class Form3 : Form
    {
        public string ClassID
        {
            get { return textBox1.Text; }
            set { textBox1.Text = value; }
        }

        public string ClassName
        {
            get { return textBox2.Text; }
            set { textBox2.Text = value; }
        }
        public int SchoolId { get; set; }

        public Form3()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ClassName))
            {
                MessageBox.Show("Class name cannot be empty!");
                return;
            }
            if (string.IsNullOrEmpty(ClassID))
            {
                MessageBox.Show("Class ID cannot be empty!");
                return;
            }
            if (!string.IsNullOrEmpty(textBox3.Text))
            {
                SchoolId = Convert.ToInt32(textBox3.Text);
            }
            else
            {
                MessageBox.Show("Please select a school.");
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
    }
}
